Skip to content

feat(tui): add session delete confirmation#444

Open
egdev6 wants to merge 4 commits into
Gentleman-Programming:mainfrom
egdev6:feat/tui-session-delete
Open

feat(tui): add session delete confirmation#444
egdev6 wants to merge 4 commits into
Gentleman-Programming:mainfrom
egdev6:feat/tui-session-delete

Conversation

@egdev6
Copy link
Copy Markdown
Contributor

@egdev6 egdev6 commented May 28, 2026

🔗 Linked Issue

Closes #94


🏷️ PR Type

  • type:bug — Bug fix
  • type:feature — New feature
  • type:docs — Documentation only
  • type:refactor — Code refactoring (no behavior change)
  • type:chore — Maintenance, dependencies, tooling
  • type:breaking-change — Breaking change

📝 Summary

  • Adds a d keybinding on the TUI sessions list to delete the selected session.
  • Requires an explicit y/n/esc confirmation before calling store.DeleteSession.
  • Refreshes the session list on success and surfaces store safety errors when deletion is blocked.

📂 Changes

File Change
internal/tui/model.go Add session delete state, result message, and store-backed delete command.
internal/tui/update.go Add sessions-list delete keybinding, confirmation state machine, success refresh, and error handling.
internal/tui/view.go Render delete confirmation prompt and advertise the delete keybinding.
internal/tui/update_test.go Cover prompt open/cancel, confirm success, blocked delete errors, and empty-list no-op.
internal/tui/view_test.go Cover delete confirmation rendering and help options.

🧪 Test Plan

  • Unit tests pass locally: go test ./...
  • E2E tests pass locally: go test -tags e2e ./internal/server/...
  • Manually tested the affected functionality

Additional focused validation:

  • go test ./internal/tui/...
  • go test ./internal/store -run DeleteSession
  • go test -cover ./internal/tui ./internal/store (internal/tui: 99.0%, internal/store: 78.3%)

🤖 Automated Checks

These run automatically and all must pass before merge:

Check What it verifies Status
Check Issue Reference PR body contains Closes #N / Fixes #N / Resolves #N
Check Issue Has status:approved Linked issue has status:approved label
Check PR Has type:* Label PR has exactly one type:* label
Unit Tests go test ./... passes
E2E Tests go test -tags e2e ./internal/server/... passes

✅ Contributor Checklist

  • I linked an approved issue above (Closes #N)
  • I added exactly one type:* label to this PR
  • I ran unit tests locally: go test ./...
  • I ran e2e tests locally: go test -tags e2e ./internal/server/...
  • Docs updated (if behavior changed)
  • Commits follow conventional commits format
  • No Co-Authored-By trailers in commits

💬 Notes for Reviewers

This implements only the remaining TUI scope from the latest maintainer comment on #94. Store, HTTP, and CLI session deletion already exist; this PR reuses store.DeleteSession and lets the store enforce safety rules such as blocking sessions with observations.

Copilot AI review requested due to automatic review settings May 28, 2026 15:43
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds an interactive “delete session” flow to the TUI sessions screen, including a confirmation prompt, keybindings, and coverage for the new behavior.

Changes:

  • Render a session delete confirmation prompt in the Sessions view and update help text to advertise the delete keybinding.
  • Add delete prompt state + delete command/message handling to the TUI update loop.
  • Add unit tests for the prompt rendering and delete keyflow (confirm/cancel, success/failure).

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
internal/tui/view.go Renders delete confirmation prompt and updates Sessions help text to include delete key.
internal/tui/update.go Handles delete prompt keyflow, processes delete results, and clamps cursor/scroll after sessions refresh.
internal/tui/model.go Adds delete-related model state, message type, and delete command.
internal/tui/view_test.go Tests that the delete prompt renders expected content.
internal/tui/update_test.go Tests delete prompt open/cancel/confirm flows and error handling.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/tui/model.go
Comment thread internal/tui/update.go Outdated
Comment thread internal/tui/update.go
Comment thread internal/tui/update.go
@egdev6 egdev6 requested a review from Copilot May 28, 2026 15:54
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Comment thread internal/tui/update.go
Comment thread internal/tui/update.go
@egdev6 egdev6 requested a review from Copilot May 28, 2026 16:32
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Comment thread internal/tui/update.go Outdated
Comment thread internal/tui/model.go Outdated
@egdev6
Copy link
Copy Markdown
Contributor Author

egdev6 commented May 28, 2026

Addressed the latest Copilot comments in commit 1ffa160:

  • handleSessionsKeys now accepts both d and D for opening the session delete prompt.
  • Replaced the two delete-state booleans with a single explicit SessionDeleteState enum (None, Prompt, Deleting) to prevent invalid prompt/deleting combinations.

Validation after the fix:

  • go test ./internal/tui/...
  • go test ./internal/store -run DeleteSession
  • go test ./...
  • go test -cover ./internal/tui ./internal/store

PR still needs a maintainer to add exactly one label: type:feature.

@egdev6
Copy link
Copy Markdown
Contributor Author

egdev6 commented May 28, 2026

@Alan-TheGentleman ready for review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Engram TUI permitir borrar sessions manualmente

2 participants